package dbops

//内置的一些权限,由服务器修改
const (
	QX_NZ_CREATE_NODE = "NZ_CREATE_NODE" //创建节点的权限
)

func PermissionInspection(userId, nodeParentId string) (bool, error) {
	if userId == "10000" {
		return true, nil
	}
	stmtOut, err := dbConn.Prepare("SELECT * FROM table_tree_structure_user WHERE node_id=? AND user_id=?")
	if err != nil {
		return false, err
	}
	defer stmtOut.Close()
	rows, err := stmtOut.Query(nodeParentId, userId)
	if err != nil {
		return false, err
	}
	if rows.Next() {
		return true, nil
	}
	return false, nil
}
